package main

import (
	"fmt"
)

type Point struct {
	x int
	y int
}

func main() {
	var a interface{}
	var point Point = Point{1, 2}
	a = point
	var b Point
	//b = a 错误
	b = a.(Point) // 把空接口转换成括号里面的类型：类型断言
	//接口是一般类型，要转成具体类型，需要使用类型断言
	fmt.Println(b)
	var sallary float32 = 7.66
	a = sallary
	//var sallary1 float64
	if y, ok := a.(float32); ok {
		fmt.Println("转换成功")
		fmt.Printf("y的类型是%T,值是%v \n", y, y)
	} else {
		fmt.Println("convert unsuccessfully")
	}
}
